/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Company.java
 *
 * Created on Dec 29, 2010, 11:26:31 PM
 */

package GUI;

import java.io.IOException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author Toshiba Satellite
 */
public class Company extends javax.swing.JDialog {

    /** Creates new form Company */
    private ArrayList<Entity.Company> arrCompany1;
    private ArrayList<Entity.Company> arrCompany2;


    public Company(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
        refresh();
        txtAddID.setText(""+(dao.Company.getTop1CompanyID()+1));
        setLocationRelativeTo(null);
        
    }



    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel2 = new javax.swing.JPanel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jTextField6 = new javax.swing.JTextField();
        jButton3 = new javax.swing.JButton();
        jTextField7 = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jTextField8 = new javax.swing.JTextField();
        jTextField9 = new javax.swing.JTextField();
        jTextField10 = new javax.swing.JTextField();
        jScrollPane3 = new javax.swing.JScrollPane();
        jTextArea2 = new javax.swing.JTextArea();
        jPanel4 = new javax.swing.JPanel();
        tabbedCompany = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        txtAddID = new javax.swing.JTextField();
        txtAddPhone = new javax.swing.JTextField();
        txtAddAddress = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        txtAddName = new javax.swing.JTextField();
        txtAddWebsite = new javax.swing.JTextField();
        jScrollPane1 = new javax.swing.JScrollPane();
        txtAddAbout = new javax.swing.JTextArea();
        btnNewAdd = new javax.swing.JButton();
        btnAdd = new javax.swing.JButton();
        jLabel25 = new javax.swing.JLabel();
        txtAddFax = new javax.swing.JTextField();
        jPanel3 = new javax.swing.JPanel();
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        txtEditID = new javax.swing.JTextField();
        txtEditPhone = new javax.swing.JTextField();
        txtEditAddress = new javax.swing.JTextField();
        jLabel17 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        txtEditName = new javax.swing.JTextField();
        txtEditWebsite = new javax.swing.JTextField();
        jScrollPane4 = new javax.swing.JScrollPane();
        txtEditAbout = new javax.swing.JTextArea();
        btnUpdate = new javax.swing.JButton();
        btnDelete = new javax.swing.JButton();
        jLabel26 = new javax.swing.JLabel();
        txtEditFax = new javax.swing.JTextField();
        jPanel5 = new javax.swing.JPanel();
        jLabel19 = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        jLabel21 = new javax.swing.JLabel();
        jLabel22 = new javax.swing.JLabel();
        txtSearchID = new javax.swing.JTextField();
        txtSearchPhone = new javax.swing.JTextField();
        txtSearchAddress = new javax.swing.JTextField();
        jLabel23 = new javax.swing.JLabel();
        jLabel24 = new javax.swing.JLabel();
        txtSearchName = new javax.swing.JTextField();
        txtSearchWebsite = new javax.swing.JTextField();
        jScrollPane5 = new javax.swing.JScrollPane();
        txtSearchAbout = new javax.swing.JTextArea();
        btnNewSearch = new javax.swing.JButton();
        jLabel27 = new javax.swing.JLabel();
        txtSearchFax = new javax.swing.JTextField();
        jScrollPane2 = new javax.swing.JScrollPane();
        tblCompany = new javax.swing.JTable();
        jButton7 = new javax.swing.JButton();

        jLabel7.setText("Code:");

        jLabel8.setText("Phone:");

        jLabel9.setText("Address:");

        jLabel10.setText("About:");

        jTextField6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextField6ActionPerformed(evt);
            }
        });

        jButton3.setText("New Search");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        jLabel11.setText("Name:");

        jLabel12.setText("Website:");

        jTextArea2.setColumns(20);
        jTextArea2.setRows(5);
        jScrollPane3.setViewportView(jTextArea2);

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(35, 35, 35)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel9)
                    .addComponent(jLabel10)
                    .addComponent(jLabel8)
                    .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(10, 10, 10)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jButton3)
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addGroup(jPanel2Layout.createSequentialGroup()
                            .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(jTextField7)
                                .addComponent(jTextField6, javax.swing.GroupLayout.DEFAULT_SIZE, 220, Short.MAX_VALUE))
                            .addGap(36, 36, 36)
                            .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jLabel12)
                                .addComponent(jLabel11))
                            .addGap(18, 18, 18)
                            .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(jTextField8, javax.swing.GroupLayout.PREFERRED_SIZE, 245, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jTextField9)))
                        .addComponent(jTextField10)
                        .addComponent(jScrollPane3)))
                .addContainerGap(23, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel11)
                        .addComponent(jTextField8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jLabel7))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8)
                    .addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel12)
                    .addComponent(jTextField9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(jTextField10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel10)
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 22, Short.MAX_VALUE)
                .addComponent(jButton3)
                .addContainerGap())
        );

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 685, Short.MAX_VALUE)
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 253, Short.MAX_VALUE)
        );

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Company");
        setLocationByPlatform(true);

        jLabel1.setText("ID:");

        jLabel2.setText("Phone:");

        jLabel3.setText("Address:");

        jLabel4.setText("About:");

        txtAddID.setEnabled(false);

        txtAddPhone.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtAddPhoneActionPerformed(evt);
            }
        });

        jLabel5.setText("Name:");

        jLabel6.setText("Website:");

        txtAddAbout.setColumns(20);
        txtAddAbout.setRows(5);
        jScrollPane1.setViewportView(txtAddAbout);

        btnNewAdd.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/Icon/ok.png"))); // NOI18N
        btnNewAdd.setText("New Add");
        btnNewAdd.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnNewAddActionPerformed(evt);
            }
        });

        btnAdd.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/Icon/plus.png"))); // NOI18N
        btnAdd.setText("Add");
        btnAdd.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAddActionPerformed(evt);
            }
        });

        jLabel25.setText("fax:");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(40, 40, 40)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel3)
                    .addComponent(jLabel4)
                    .addComponent(jLabel2)
                    .addComponent(jLabel1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(35, 35, 35)
                        .addComponent(btnNewAdd)
                        .addGap(18, 18, 18)
                        .addComponent(btnAdd, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addGap(37, 37, 37)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 563, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(txtAddAddress, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 220, Short.MAX_VALUE)
                                    .addComponent(txtAddPhone, javax.swing.GroupLayout.DEFAULT_SIZE, 220, Short.MAX_VALUE)
                                    .addComponent(txtAddID, javax.swing.GroupLayout.DEFAULT_SIZE, 220, Short.MAX_VALUE))
                                .addGap(18, 18, 18)
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel5)
                                    .addComponent(jLabel6)
                                    .addComponent(jLabel25))
                                .addGap(32, 32, 32)
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(txtAddFax)
                                    .addComponent(txtAddName, javax.swing.GroupLayout.DEFAULT_SIZE, 250, Short.MAX_VALUE)
                                    .addComponent(txtAddWebsite, javax.swing.GroupLayout.DEFAULT_SIZE, 250, Short.MAX_VALUE))))))
                .addGap(199, 199, 199))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtAddName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel5)
                    .addComponent(txtAddID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtAddWebsite, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel6)
                    .addComponent(txtAddPhone, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(txtAddAddress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel3))
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel25)
                        .addComponent(txtAddFax, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(btnNewAdd)
                            .addComponent(btnAdd)))
                    .addComponent(jLabel4))
                .addContainerGap())
        );

        tabbedCompany.addTab("Add", new javax.swing.ImageIcon("C:\\Documents and Settings\\Toshiba Satellite\\Desktop\\eproject\\tai lieu thiet ke\\thiet ke so bo 28-12-2010\\thiet_ke_so_bo\\src\\Image\\Icon\\plus.png"), jPanel1); // NOI18N

        jLabel13.setText("ID:");

        jLabel14.setText("Phone:");

        jLabel15.setText("Address:");

        jLabel16.setText("About:");

        txtEditID.setEnabled(false);

        txtEditPhone.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtEditPhoneActionPerformed(evt);
            }
        });

        jLabel17.setText("Name:");

        jLabel18.setText("Website:");

        txtEditAbout.setColumns(20);
        txtEditAbout.setRows(5);
        jScrollPane4.setViewportView(txtEditAbout);

        btnUpdate.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/Icon/upcoming-work.png"))); // NOI18N
        btnUpdate.setText("Update");
        btnUpdate.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnUpdateActionPerformed(evt);
            }
        });

        btnDelete.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/Icon/delete.png"))); // NOI18N
        btnDelete.setText("Delete");
        btnDelete.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnDeleteActionPerformed(evt);
            }
        });

        jLabel26.setText("fax:");

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGap(40, 40, 40)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel15)
                    .addComponent(jLabel16)
                    .addComponent(jLabel14)
                    .addComponent(jLabel13))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGap(35, 35, 35)
                        .addComponent(btnUpdate)
                        .addGap(18, 18, 18)
                        .addComponent(btnDelete))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                        .addGap(37, 37, 37)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 563, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(txtEditAddress, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 220, Short.MAX_VALUE)
                                    .addComponent(txtEditPhone, javax.swing.GroupLayout.DEFAULT_SIZE, 220, Short.MAX_VALUE)
                                    .addComponent(txtEditID, javax.swing.GroupLayout.DEFAULT_SIZE, 220, Short.MAX_VALUE))
                                .addGap(18, 18, 18)
                                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel17)
                                    .addComponent(jLabel18)
                                    .addComponent(jLabel26))
                                .addGap(32, 32, 32)
                                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(txtEditFax)
                                    .addComponent(txtEditName, javax.swing.GroupLayout.DEFAULT_SIZE, 250, Short.MAX_VALUE)
                                    .addComponent(txtEditWebsite, javax.swing.GroupLayout.DEFAULT_SIZE, 250, Short.MAX_VALUE))))))
                .addGap(199, 199, 199))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtEditName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel17)
                    .addComponent(txtEditID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel13))
                .addGap(18, 18, 18)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtEditWebsite, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel18)
                    .addComponent(txtEditPhone, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel14))
                .addGap(18, 18, 18)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtEditAddress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel15)
                    .addComponent(jLabel26)
                    .addComponent(txtEditFax, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(btnUpdate)
                            .addComponent(btnDelete)))
                    .addComponent(jLabel16))
                .addContainerGap())
        );

        tabbedCompany.addTab("Edit", new javax.swing.ImageIcon(getClass().getResource("/Image/Icon/Edit.png")), jPanel3); // NOI18N

        jLabel19.setText("ID:");

        jLabel20.setText("Phone:");

        jLabel21.setText("Address:");

        jLabel22.setText("About:");

        txtSearchID.addCaretListener(new javax.swing.event.CaretListener() {
            public void caretUpdate(javax.swing.event.CaretEvent evt) {
                txtSearchIDCaretUpdate(evt);
            }
        });

        txtSearchPhone.addCaretListener(new javax.swing.event.CaretListener() {
            public void caretUpdate(javax.swing.event.CaretEvent evt) {
                txtSearchPhoneCaretUpdate(evt);
            }
        });
        txtSearchPhone.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtSearchPhoneActionPerformed(evt);
            }
        });

        txtSearchAddress.addCaretListener(new javax.swing.event.CaretListener() {
            public void caretUpdate(javax.swing.event.CaretEvent evt) {
                txtSearchAddressCaretUpdate(evt);
            }
        });

        jLabel23.setText("Name:");

        jLabel24.setText("Website:");

        txtSearchName.addCaretListener(new javax.swing.event.CaretListener() {
            public void caretUpdate(javax.swing.event.CaretEvent evt) {
                txtSearchNameCaretUpdate(evt);
            }
        });

        txtSearchWebsite.addCaretListener(new javax.swing.event.CaretListener() {
            public void caretUpdate(javax.swing.event.CaretEvent evt) {
                txtSearchWebsiteCaretUpdate(evt);
            }
        });

        txtSearchAbout.setColumns(20);
        txtSearchAbout.setRows(5);
        txtSearchAbout.addCaretListener(new javax.swing.event.CaretListener() {
            public void caretUpdate(javax.swing.event.CaretEvent evt) {
                txtSearchAboutCaretUpdate(evt);
            }
        });
        jScrollPane5.setViewportView(txtSearchAbout);

        btnNewSearch.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/Icon/search.png"))); // NOI18N
        btnNewSearch.setText("New Search");
        btnNewSearch.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnNewSearchActionPerformed(evt);
            }
        });

        jLabel27.setText("fax:");

        txtSearchFax.addCaretListener(new javax.swing.event.CaretListener() {
            public void caretUpdate(javax.swing.event.CaretEvent evt) {
                txtSearchFaxCaretUpdate(evt);
            }
        });

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addGap(40, 40, 40)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel21)
                    .addComponent(jLabel22)
                    .addComponent(jLabel20)
                    .addComponent(jLabel19))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addGap(35, 35, 35)
                        .addComponent(btnNewSearch))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
                        .addGap(37, 37, 37)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 563, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
                                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(txtSearchAddress, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 220, Short.MAX_VALUE)
                                    .addComponent(txtSearchPhone, javax.swing.GroupLayout.DEFAULT_SIZE, 220, Short.MAX_VALUE)
                                    .addComponent(txtSearchID, javax.swing.GroupLayout.DEFAULT_SIZE, 220, Short.MAX_VALUE))
                                .addGap(18, 18, 18)
                                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel23)
                                    .addComponent(jLabel24)
                                    .addComponent(jLabel27))
                                .addGap(32, 32, 32)
                                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(txtSearchFax)
                                    .addComponent(txtSearchName, javax.swing.GroupLayout.DEFAULT_SIZE, 250, Short.MAX_VALUE)
                                    .addComponent(txtSearchWebsite, javax.swing.GroupLayout.DEFAULT_SIZE, 250, Short.MAX_VALUE))))))
                .addGap(199, 199, 199))
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtSearchName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel23)
                    .addComponent(txtSearchID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel19))
                .addGap(18, 18, 18)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtSearchWebsite, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel24)
                    .addComponent(txtSearchPhone, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel20))
                .addGap(18, 18, 18)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtSearchAddress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel21)
                    .addComponent(jLabel27)
                    .addComponent(txtSearchFax, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(btnNewSearch))
                    .addComponent(jLabel22))
                .addContainerGap())
        );

        tabbedCompany.addTab("Search", new javax.swing.ImageIcon(getClass().getResource("/Image/Icon/search.png")), jPanel5); // NOI18N

        tblCompany.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {

            }
        ));
        tblCompany.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tblCompanyMouseClicked(evt);
            }
            public void mousePressed(java.awt.event.MouseEvent evt) {
                tblCompanyMousePressed(evt);
            }
            public void mouseReleased(java.awt.event.MouseEvent evt) {
                tblCompanyMouseReleased(evt);
            }
        });
        jScrollPane2.setViewportView(tblCompany);

        jButton7.setText("Close");
        jButton7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton7ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(tabbedCompany, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 690, Short.MAX_VALUE)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 690, Short.MAX_VALUE)
                    .addComponent(jButton7, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(tabbedCompany, javax.swing.GroupLayout.PREFERRED_SIZE, 281, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(27, 27, 27)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 161, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 18, Short.MAX_VALUE)
                .addComponent(jButton7)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jButton3ActionPerformed

    private void jTextField6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField6ActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jTextField6ActionPerformed

    private void txtAddPhoneActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtAddPhoneActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_txtAddPhoneActionPerformed

    private void btnNewAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNewAddActionPerformed
        // TODO add your handling code here:
        resetAdd_Form();

}//GEN-LAST:event_btnNewAddActionPerformed

    private void txtEditPhoneActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtEditPhoneActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtEditPhoneActionPerformed

    private void btnUpdateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnUpdateActionPerformed
        // TODO add your handling code here:
        int choice = JOptionPane.showConfirmDialog(this, "Do you want to update information of this company?","Update company",JOptionPane.YES_NO_CANCEL_OPTION);
        
        
        if(choice== JOptionPane.YES_OPTION)
        {
        Entity.Company com = new Entity.Company();
        
        com.setCompanyID(Integer.parseInt(txtEditID.getText()));
        com.setName(txtEditName.getText());
        com.setAddress(txtEditAddress.getText());
        com.setPhoneNumber(txtEditPhone.getText());
        com.setIntroduction(txtEditAbout.getText());
        com.setWebsite(txtEditWebsite.getText());
        com.setFax(txtEditFax.getText());
        
        dao.Company.update(com);
        
        JOptionPane.showMessageDialog(this, "Updated successfully!");
        
        refresh();
        }

    }//GEN-LAST:event_btnUpdateActionPerformed

    private void txtSearchPhoneActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtSearchPhoneActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtSearchPhoneActionPerformed

    private void btnNewSearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNewSearchActionPerformed
        // TODO add your handling code here:
       resetSearch_Form();
    }//GEN-LAST:event_btnNewSearchActionPerformed

    private void btnAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddActionPerformed
        // TODO add your handling code here:
        if(check_add())
        {
            Entity.Company com = new Entity.Company(
            txtAddName.getText(),
            txtAddAddress.getText(),
            txtAddPhone.getText(),
            txtAddAbout.getText(),
            txtAddWebsite.getText(),
            txtAddFax.getText()
            );
            if(!dao.Company.insert(com))
            JOptionPane.showMessageDialog(this, "Cannot add this company ");

            resetAdd_Form();

            refresh();
        }


    }//GEN-LAST:event_btnAddActionPerformed

    private void tblCompanyMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblCompanyMousePressed
        // TODO add your handling code here:
        int iSelectedRow = tblCompany.getSelectedRow();

        if(iSelectedRow>=0)
        {
            txtEditID.setText(arrCompany2.get(iSelectedRow).getCompanyID()+"");
            txtEditName.setText(arrCompany2.get(iSelectedRow).getName()+"");
            txtEditPhone.setText(arrCompany2.get(iSelectedRow).getPhoneNumber()+"");
            txtEditAddress.setText(arrCompany2.get(iSelectedRow).getAddress()+"");
            txtEditWebsite.setText(arrCompany2.get(iSelectedRow).getWebsite()+"");
            txtEditAbout.setText(arrCompany2.get(iSelectedRow).getIntroduction()+"");
            txtEditFax.setText(arrCompany2.get(iSelectedRow).getFax()+"");

        }

                      
    }//GEN-LAST:event_tblCompanyMousePressed

    private void btnDeleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDeleteActionPerformed
        // TODO add your handling code here:
         int choice = JOptionPane.showConfirmDialog(this, "Do you want to delete information of this company?","Delete company",JOptionPane.YES_NO_CANCEL_OPTION);


        if(choice== JOptionPane.YES_OPTION)
        {
            try {
                Entity.Company com = new Entity.Company();

                com.setCompanyID(Integer.parseInt(txtEditID.getText()));
                com.setName(txtEditName.getText());
                com.setAddress(txtEditAddress.getText());
                com.setPhoneNumber(txtEditPhone.getText());
                com.setIntroduction(txtEditAbout.getText());
                com.setWebsite(txtEditWebsite.getText());
                com.setFax(txtEditFax.getText());


                dao.Company.delete(com);



                JOptionPane.showMessageDialog(this, "Deleted successfully!");

                refresh();
            } catch (Exception e) {
               JOptionPane.showMessageDialog(this,"Can not delete this company");

            }

        }



    }//GEN-LAST:event_btnDeleteActionPerformed

    private void tblCompanyMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblCompanyMouseClicked
        // TODO add your handling code here:
        

    }//GEN-LAST:event_tblCompanyMouseClicked

    private void tblCompanyMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblCompanyMouseReleased
        // TODO add your handling code here:
        int iSelectedRow = tblCompany.getSelectedRow();
        int iSelectedColumn = tblCompany.getSelectedColumn();
        System.out.println(iSelectedColumn);
        System.out.println(iSelectedRow);
        tabbedCompany.setSelectedIndex(1);
//        if(iSelectedRow>0 && iSelectedColumn==4);
//        {
//            try {
//            Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler http://"+arrCompany2.get(iSelectedRow).getWebsite());
//            } catch (IOException ex) {
//                ex.printStackTrace();
//            }
//        }
    }//GEN-LAST:event_tblCompanyMouseReleased

    private void txtSearchIDCaretUpdate(javax.swing.event.CaretEvent evt) {//GEN-FIRST:event_txtSearchIDCaretUpdate
        // TODO add your handling code here:
        search();
    }//GEN-LAST:event_txtSearchIDCaretUpdate

    private void txtSearchNameCaretUpdate(javax.swing.event.CaretEvent evt) {//GEN-FIRST:event_txtSearchNameCaretUpdate
        // TODO add your handling code here:
        search();
    }//GEN-LAST:event_txtSearchNameCaretUpdate

    private void txtSearchPhoneCaretUpdate(javax.swing.event.CaretEvent evt) {//GEN-FIRST:event_txtSearchPhoneCaretUpdate
        // TODO add your handling code here:
        search();
    }//GEN-LAST:event_txtSearchPhoneCaretUpdate

    private void txtSearchWebsiteCaretUpdate(javax.swing.event.CaretEvent evt) {//GEN-FIRST:event_txtSearchWebsiteCaretUpdate
        // TODO add your handling code here:
        search();
    }//GEN-LAST:event_txtSearchWebsiteCaretUpdate

    private void txtSearchAddressCaretUpdate(javax.swing.event.CaretEvent evt) {//GEN-FIRST:event_txtSearchAddressCaretUpdate
        // TODO add your handling code here:
        search();
    }//GEN-LAST:event_txtSearchAddressCaretUpdate

    private void txtSearchFaxCaretUpdate(javax.swing.event.CaretEvent evt) {//GEN-FIRST:event_txtSearchFaxCaretUpdate
        // TODO add your handling code here:
        search();
    }//GEN-LAST:event_txtSearchFaxCaretUpdate

    private void txtSearchAboutCaretUpdate(javax.swing.event.CaretEvent evt) {//GEN-FIRST:event_txtSearchAboutCaretUpdate
        // TODO add your handling code here:
        search();
    }//GEN-LAST:event_txtSearchAboutCaretUpdate

    private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed
        // TODO add your handling code here:
        this.dispose();
    }//GEN-LAST:event_jButton7ActionPerformed
    
    private void search()
    {
        arrCompany2 = new ArrayList<Entity.Company>();

        for(Entity.Company com : arrCompany1)
        {
            if(
                    String.valueOf(com.getCompanyID()).matches(".*"+txtSearchID.getText()+".*")&&
                    com.getName().toLowerCase().matches(".*"+txtSearchName.getText().toLowerCase()+".*")&&
                    com.getAddress().toLowerCase().matches(".*"+txtSearchPhone.getText().toLowerCase()+".*")&&
                    com.getPhoneNumber().toLowerCase().matches(".*"+txtSearchPhone.getText().toLowerCase()+".*")&&
                  //  com.getIntroduction().toLowerCase().matches(".*"+txtSearchAbout.getText().toLowerCase()+".*")&&
                    com.getWebsite().toLowerCase().matches(""+txtSearchWebsite.getText().toLowerCase()+".*")&&
                    com.getFax().toLowerCase().matches(".*"+txtSearchFax.getText().toLowerCase()+".*")

            )
            {
                    arrCompany2.add(com);
            }
        }
        tblCompany.setModel(new model.Company(arrCompany2));
    }
    ////
//    for(entity.Client cli : alCli) {
//        if(
//                String.valueOf(cli.getClientID()).matches(".*" + txtCode_search.getText() + ".*") &&
//                cli.getClientName().toLowerCase().matches(".*" + txtName_search.getText().toLowerCase() + ".*") &&
//                cli.getPhone().matches(".*" + txtPhone_search.getText() + ".*") &&
//                cli.getWeb().toLowerCase().matches(".*" + txtWeb_search.getText().toLowerCase() + ".*") &&
//                cli.getAddress().toLowerCase().matches(".*" + txtAddress_search.getText().toLowerCase() + ".*") &&
//                cli.getAbout().toLowerCase().matches(".*" + txtAbout_search.getText().toLowerCase() + ".*")) {
//
//            alFilter.add(cli);
//        }
//    }
    ////
    private void refresh()
    {
        arrCompany1 = dao.Company.getAll();
       // tblCompany.setModel(new model.Company(arrCompany1));
        search();
    }
    
    
    private boolean check_add()
    {
        if(txtAddName.getText().equals(""))
        {
            txtAddName.requestFocus();

            JOptionPane.showMessageDialog(this, "Please enter value of Name Field");
            return false;
        }

        if(txtAddAddress.getText().equals(""))
        {
            txtAddAddress.requestFocus();
            JOptionPane.showMessageDialog(this, "Please enter value of Phone Number field");

            return false;
        }

        if(txtAddAbout.getText().equals(""))
        {
            txtAddAbout.requestFocus();
            JOptionPane.showMessageDialog(this, "Please enter value of About field");

            return false;
        }

        if(txtAddWebsite.getText().equals(""))
        {
            txtAddWebsite.requestFocus();
            JOptionPane.showMessageDialog(this, "Please enter value of Website field");

            return false;
        }

        if(txtAddFax.getText().equals(""))
        {
            txtAddFax.requestFocus();
            JOptionPane.showMessageDialog(this, "Please enter value of Fax field");

            return false;
        }

        return true;
    }

    private void resetAdd_Form()
    {
        txtAddID.setText("");
        txtAddName.setText("");
        txtAddAddress.setText("");
        txtAddPhone.setText("");
        txtAddAbout.setText("");
        txtAddWebsite.setText("");
        txtAddFax.setText("");

    }

    private void resetSearch_Form()
    {
        txtSearchAbout.setText("");
        txtSearchAddress.setText("");
        txtSearchFax.setText("");
        txtSearchID.setText("");
        txtSearchName.setText("");
        txtSearchPhone.setText("");
        txtSearchWebsite.setText("");
    }


    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                Company dialog = new Company(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });

                dialog.setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnAdd;
    private javax.swing.JButton btnDelete;
    private javax.swing.JButton btnNewAdd;
    private javax.swing.JButton btnNewSearch;
    private javax.swing.JButton btnUpdate;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton7;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JTextArea jTextArea2;
    private javax.swing.JTextField jTextField10;
    private javax.swing.JTextField jTextField6;
    private javax.swing.JTextField jTextField7;
    private javax.swing.JTextField jTextField8;
    private javax.swing.JTextField jTextField9;
    private javax.swing.JTabbedPane tabbedCompany;
    private javax.swing.JTable tblCompany;
    private javax.swing.JTextArea txtAddAbout;
    private javax.swing.JTextField txtAddAddress;
    private javax.swing.JTextField txtAddFax;
    private javax.swing.JTextField txtAddID;
    private javax.swing.JTextField txtAddName;
    private javax.swing.JTextField txtAddPhone;
    private javax.swing.JTextField txtAddWebsite;
    private javax.swing.JTextArea txtEditAbout;
    private javax.swing.JTextField txtEditAddress;
    private javax.swing.JTextField txtEditFax;
    private javax.swing.JTextField txtEditID;
    private javax.swing.JTextField txtEditName;
    private javax.swing.JTextField txtEditPhone;
    private javax.swing.JTextField txtEditWebsite;
    private javax.swing.JTextArea txtSearchAbout;
    private javax.swing.JTextField txtSearchAddress;
    private javax.swing.JTextField txtSearchFax;
    private javax.swing.JTextField txtSearchID;
    private javax.swing.JTextField txtSearchName;
    private javax.swing.JTextField txtSearchPhone;
    private javax.swing.JTextField txtSearchWebsite;
    // End of variables declaration//GEN-END:variables

}
